import Vue from 'vue'
import VueRouter from 'vue-router'
import SmartWearables from "@/views/smart/SmartWearables.vue";
import LoginIndex from '@/views/login'
import UserIndex from '@/views/user'
import RegisterIndex from '@/views/register'


//如果在一个模块化工程中使用它，必须要通过 Vue.use() 明确地安装路由功能
Vue.use(VueRouter)

//定义路由列表
const  routes = [
    {
        path:'/',
        component:SmartWearables,
        children:[
            {
                path:'/earphone',
                component:()=>import('@/views/smart/Earphone.vue')
            },
            {
                path:'/apparel',
                component:()=>import('@/views/smart/Apparel.vue')
            }
        ]
    },
    {
        path: "/login",
        component: LoginIndex
    },
    {
        path: "/user",
        component: UserIndex
    },
    {
        path: "/register",
        component: RegisterIndex
    }
]

// 定义路由实例
const  router  = new VueRouter({
    routes
})

// 导出路由对象
export default router